import socket

def main():

    # 创建 socket 
    client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    # 连接
    client.connect(("localhost", 8888))

    send_data = input("请输入要发送的数据：")

    # 发送数据
    client.send(send_data.encode("utf-8"))

    # 关闭 socket
    client.close()

if __name__ == '__main__':
    main()
    